package com.tubi.zifuliu;

import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

public class 字符读取数据 {
    public static void main(String[] args) throws IOException {
        FileReader fr = new FileReader("test-IO/a.txt");

        //一次读取一个字符
        /*
        int a;
        while ((a=fr.read())!=-1){
            System.out.println((char) a);
        }*/



        //一次读取多个字符
        char[] chars = new char[1024];

        int len;

        while ((len=fr.read(chars)) != -1){
            System.out.println(
                    new String(chars,0,len)
            );
        }




        //  释放资源
        fr.close();
    }
}
